﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _06.FactDelPow
{
    class FactDelPow
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Insert n");
            Console.Write("n= ");
            decimal  n = decimal.Parse(Console.ReadLine());
            Console.Write("x= ");
            decimal  x = decimal.Parse(Console.ReadLine());
            decimal nRes = 1, xRes = 1,sum = 1;
            for (int i = 1; i <=n; i++)
            {
                nRes *= i;
                xRes *= x;
                if (xRes != 0)
                {
                    sum += nRes / xRes;
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(sum);
        }
    }
}
